/*
Miranda IM for Windows Search

Copyright (C) 2012 Nikolay Raspopov

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

#pragma once

// Produces two arguments divided by comma, where first argument is a string itself
// and second argument is a string length without null terminator
#define _P(x)	(x),((sizeof(x))/sizeof((x)[0])-1)
#define _PT(x)	_P(_T(x))

#define IsSpace(ch)	((ch) == _T(' ') || (ch) == _T('\t') || (ch) == _T('\r') || (ch) == _T('\n'))

CStringA UTF8Encode(__in_bcount(nInput) LPCWSTR psInput, __in int nInput);
CStringA UTF8Encode(__in const CStringW& strInput);
CStringW UTF8Decode(__in_bcount(nInput) LPCSTR psInput, __in int nInput);
CStringW UTF8Decode(__in const CStringA& strInput);
CString URLEncode(LPCTSTR pszInputT);
CString URLDecodeANSI(LPCTSTR pszInput);
CString URLDecodeUnicode(LPCTSTR pszInput);
CString URLDecode(LPCTSTR pszInput);
CString URLDecode(__in_bcount(nInput) LPCSTR psInput, __in int nInput);
CString URLDecode(__in const CStringA& strInput);

// Escape unsafe symbols
CString Escape(const CString& strValue);

// Unescape unsafe symbols
CString Unescape(LPCTSTR pszXML, int nLength = -1);
